home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 …ember: Reference Library / Dev.CD Dec 00 RL Disk 1.toast / pc / technical documentation / develop / develop issue 27 / develop issue 27 code / 3d game controls / source / context.c < prev    next >
Encoding:
Text File  |  1996-06-29  |  1.4 KB  |  45 lines

  1. //--------------------------------------------------------------------------------------------
  2. //  Draw Context Code
  3. //
  4. //      by Philip McBride
  5. //        parts taken from Apple DTS sample code
  6. //
  7. //--------------------------------------------------------------------------------------------
  8.  
  9.  
  10. #include "GameControls.h"
  11. #include "extern.h"
  12. #include "context.h"
  13.  
  14.  
  15. //--------------------------------------------------------------------------------------------
  16. //  Create a Draw Context
  17. //
  18. TQ3DrawContextObject MyNewDrawContext(WindowPtr theWindow)
  19. {
  20.     TQ3DrawContextData        myDrawContextData;
  21.     TQ3MacDrawContextData    myMacDrawContextData;
  22.     TQ3ColorARGB            ClearColor = kMyAClearColor;
  23.     TQ3DrawContextObject    myDrawContext ;
  24.     
  25.     //    Fill in draw context data.
  26.     myDrawContextData.clearImageMethod = kQ3ClearMethodWithColor;
  27.     myDrawContextData.clearImageColor = ClearColor;
  28.     myDrawContextData.paneState = kQ3False;
  29.     myDrawContextData.maskState = kQ3False;
  30.     myDrawContextData.doubleBufferState = kQ3True;
  31.  
  32.     myMacDrawContextData.drawContextData = myDrawContextData;
  33.     
  34.     myMacDrawContextData.window = (CGrafPtr) theWindow; // this is the window associated with the view
  35.     myMacDrawContextData.library = kQ3Mac2DLibraryNone;
  36.     myMacDrawContextData.viewPort = nil;
  37.     myMacDrawContextData.grafPort = nil;
  38.     
  39.     //    Create draw context and return it, if it’s nil the caller must handle
  40.     myDrawContext = Q3MacDrawContext_New(&myMacDrawContextData) ;
  41.  
  42.     return myDrawContext ;
  43. }
  44.  
  45.